package com.glory.cqaospda.adapter;


import android.graphics.Color;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.glory.cqaospda.R;
import com.glory.cqaospda.bean.BomBean;
import com.glory.cqaospda.bean.EqpMaterialsBean;

import java.util.List;

import androidx.annotation.Nullable;

public class LotMateriaAdapter extends BaseQuickAdapter<BomBean.Materialslist, BaseViewHolder> {
    private List<BomBean.Materialslist> datalist;
    private String type;
    private String lotID;

    public LotMateriaAdapter(@Nullable List<BomBean.Materialslist> data,String type,String lotID) {
        super(R.layout.adapter_carriertape, data);
        datalist = data;
        this.type = type;
        this.lotID = lotID;
    }

    @Override
    protected void convert(BaseViewHolder helper, BomBean.Materialslist item) {
        helper.setText(R.id.tvCarriertapeID, item.getMMaterialCode());
//        helper.setText(R.id.tvCarriertapeQty, item.getMUsage());
        helper.setText(R.id.tvMaterialUnit, item.getMUnit());
        helper.setText(R.id.tvVendorCode, item.getMWireDiameter());
        helper.setText(R.id.tvLotID, lotID);
        switch (type){
            case "carriertapeData":
                helper.setText(R.id.tvType, "载带");
                helper.setBackgroundColor(R.id.llMateria,Color.parseColor("#2E9AFE"));
//                helper.setTextColor(R.id.tvCarriertapeID, Color.parseColor("#FF0000"));
                break;
            case "reelData":
                helper.setText(R.id.tvType, "卷盘");
                helper.setBackgroundColor(R.id.llMateria,Color.parseColor("#A9E2F3"));
//                helper.setTextColor(R.id.tvCarriertapeID, Color.parseColor("#FF8000"));
                break;
            case "coverData":
                helper.setText(R.id.tvType, "料管");
                helper.setBackgroundColor(R.id.llMateria,Color.parseColor("#2E9AFE"));
//                helper.setTextColor(R.id.tvCarriertapeID, Color.parseColor("#FFFF00"));
                break;
            case "plugData":
                helper.setText(R.id.tvType, "盖带");
                helper.setBackgroundColor(R.id.llMateria,Color.parseColor("#A9E2F3"));
//                helper.setTextColor(R.id.tvCarriertapeID, Color.parseColor("#3ADF00"));
                break;
        }
    }

}
